import sys

from PyQt5.QtWidgets import QWidget, QApplication

from model.components.tableWidget import TableWidget
from util.qt import qtUtil
from view.components.ui_cardWidget import Ui_CardWidget


class CardWidget(QWidget, Ui_CardWidget):
    def __init__(self, widget: QWidget = None, title='title', parent=None):
        super().__init__(parent)
        self.setupUi(self)
        self.labelTitle.setText(title)
        if widget is not None:
            qtUtil.replaceWidget(self.container, widget)

    def setTitle(self, title):
        self.labelTitle.setText(title)


if __name__ == '__main__':
    app = QApplication(sys.argv)  # 创建GUI应用程序
    table = TableWidget()
    cardWidget = CardWidget(table)  # 创建窗体
    cardWidget.show()
    sys.exit(app.exec_())
